﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;


using MINERP.BLL.InfoConfig;
namespace MINERP.InfoConfig
{
    public partial class FrmDataClear : FrmMDIChildFormTemplate
    {

        DataClearBLL _bll = new DataClearBLL();
        private static FrmDataClear _instance = null;

        public static FrmDataClear GetInstance
        {
            get 
            {
                if (_instance == null)
                {
                    _instance = new FrmDataClear();
                }
                return _instance;
            }
        }
        private  FrmDataClear()
        {
            InitializeComponent();
        }

        private void FrmDataClear_Load(object sender, EventArgs e)
        {
            _bll.ProgressBar = pBarLinking;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if(DialogResult.OK ==MessageBox.Show("确定清除选定日期数据吗？","询问",MessageBoxButtons.OKCancel,MessageBoxIcon.Question))
            {
                btnOK.Enabled = false;
                try
                {
                    _bll.ClearPinBanData(dtDateTime.DateTime.AddDays(1));
                    
                    MessageBox.Show("清除成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                btnOK.Enabled = true;
            }
        }

        private void FrmDataClear_FormClosing(object sender, FormClosingEventArgs e)
        {
            _instance = null;
        }


    }
}
